package reflect;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ResourceBundle;

/**
 * 反射method 用到service里的userService
 */

public class ReflectTest08 {
    public static void main(String[] args) throws ClassNotFoundException {
        ResourceBundle bundle = ResourceBundle.getBundle("classinfo2");
        Class c = Class.forName(bundle.getString("className1"));

        Method[] methods= c.getDeclaredMethods();
        for (Method method:methods){
            System.out.println("******************");
            //获取修饰符
            System.out.println(Modifier.toString(method.getModifiers()));
            //获取返回值
            System.out.println(method.getReturnType().getSimpleName());
            //获取方法名
            System.out.println(method.getName());
            //获取方法参数列表---列表肯定返回是数组形式 又参数来说 数据类型更重要 所以返回class数组
            Class[] temp = method.getParameterTypes();
            for (Class cl:temp){
                System.out.println("method:"+cl.getSimpleName());
            }

        }
    }
}
